<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        var studentArray = [
            {id:1,name:"张辽",grade:90},
            {id:6,name:"张昭",grade:50},
            {id:8,name:"张飞",grade:99},
            {id:5,name:"张合",grade:86}

        ];
        var index = studentArray.findIndex( (n)=> n.name=="张辽" );
        alert(index);
    </script>
</head>
<body>

</body>
</html>